<template>
  <el-row :gutter="20">
    <el-col class="aa" :span="16">
      <bread></bread>
    </el-col>

    <el-col class="bb" :span="8">
      <div class="bb_down">
        <el-dropdown @command="handleCommand">
          <span class="el-dropdown-link">
            欢迎{{ account }}<i class="el-icon-arrow-down el-icon--right"></i>
          </span>
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item command="1">退出登录</el-dropdown-item>
            <el-dropdown-item command="2">个人中心</el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
      </div>
      <div class="bb_img">
        <img :src="imgUrl" alt="" />
      </div>
    </el-col>
  </el-row>
</template>

<script>
import bread from "@/components/bread";
import { api_findOne } from "../../api/users.js";
export default {
  data() {
    return {
      account: "",
      imgUrl: "",
    };
  },
  components: {
    bread,
  },
  mounted() {
    this.query();

    this.$bus.$on("upimg", this.query);
  },
  methods: {
    async query() {
      let rst = await api_findOne();
      let { accountInfo } = rst;
      this.account = accountInfo.account;
      this.imgUrl = accountInfo.imgUrl;
    },

    handleCommand(c) {
      if (c == 1) {
        this.logcal.remove("sell_token");
        this.$router.replace("/login");
      } else {
        this.$router.push("/users/personal");
      }
    },
  },
};
</script>

<style lang="less" scoped>
.el-row {
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  .el-breadcrumb {
    margin-top: 22px;
  }
  .bb {
    display: flex;
    justify-content: flex-end;
    align-items: center;

    .bb_img {
      width: 60px;
      height: 60px;

      img {
        width: 60px;
        height: 60px;
        border-radius: 50%;
      }
    }
  }
}
</style>